﻿using Services4KouDai.Models;
using Services4KouDai.Parsers;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Services4KouDai.Services
{
    public class HoneyService : IHoneyService
    {
        public async Task<ServiceRespInfo> GetHoneyWall(string domainName, long minTimeStamp, int count)
        {
            long maxTimeStamp = long.MaxValue;

            if (minTimeStamp != 0)
            {
                maxTimeStamp = minTimeStamp;
            }
          
            Dictionary<string, object> body = new Dictionary<string, object>();
            body.Add("domainName", domainName);
            body.Add("minTimeStamp", minTimeStamp);
            body.Add("maxTimeStamp", maxTimeStamp);
            body.Add("limit", count);

            return await CommonService.ServiceReq(ServiceConstants.HoneyWallAddress, body, new List<HoneyEntity>(), new HoneyParser()).ConfigureAwait(false);
        }
    }
}
